package daily.jun0605;

interface Calculator {
    int calc(int a, int b);
}

public class CalculatorLambdaTest {
    public static void invokeCalc(int num1, int num2, Calculator c) {
        System.out.println(c.calc(num1, num2));
    }

    public static void main(String[] args) {
        //使用匿名内部类
        invokeCalc(111, 222, new Calculator() {
            @Override
            public int calc(int a, int b) {
                return a + b;
            }
        });//输出333
        //使用Lambda表达式
        invokeCalc(333, 666, (a, b) -> a + b);//输出999
    }
}
